import 'dart:convert';

import 'package:json_annotation/json_annotation.dart';

part 'UserModel.g.dart';


@JsonSerializable()
class UserModel extends Object {

  @JsonKey(name: 'success')
  bool success;

  @JsonKey(name: 'message')
  String message;

  @JsonKey(name: 'code')
  int code;

  @JsonKey(name: 'result')
  Result result;

  @JsonKey(name: 'timestamp')
  int timestamp;

  // factory UserModel(jsonStr) => jsonStr == null ? null : jsonStr is String ? new UserModel.fromJson(json.decode(jsonStr)) : new UserModel.fromJson(jsonStr);

  UserModel(this.success,this.message,this.code,this.result,this.timestamp,);

  factory UserModel.fromJson(Map<String, dynamic> srcJson) => _$UserModelFromJson(srcJson);

  Map<String, dynamic> toJson() => _$UserModelToJson(this);

}


@JsonSerializable()
class Result extends Object {

  @JsonKey(name: 'multi_depart')
  int multiDepart;

  @JsonKey(name: 'userInfo')
  UserInfo userInfo;

  @JsonKey(name: 'departs')
  List<dynamic> departs;

  @JsonKey(name: 'token')
  String token;

  Result(this.multiDepart,this.userInfo,this.departs,this.token,);

  factory Result.fromJson(Map<String, dynamic> srcJson) => _$ResultFromJson(srcJson);

  Map<String, dynamic> toJson() => _$ResultToJson(this);

}


@JsonSerializable()
class UserInfo extends Object {

  @JsonKey(name: 'id')
  String id;

  @JsonKey(name: 'username')
  String username;

  @JsonKey(name: 'realname')
  String realname;

  @JsonKey(name: 'status')
  int status;

  @JsonKey(name: 'delFlag')
  String delFlag;

  @JsonKey(name: 'workNo')
  String workNo;

  @JsonKey(name: 'createBy')
  String createBy;

  @JsonKey(name: 'createTime')
  String createTime;

  @JsonKey(name: 'activitiSync')
  String activitiSync;

  UserInfo(this.id,this.username,this.realname,this.status,this.delFlag,this.workNo,this.createBy,this.createTime,this.activitiSync,);

  factory UserInfo.fromJson(Map<String, dynamic> srcJson) => _$UserInfoFromJson(srcJson);

  Map<String, dynamic> toJson() => _$UserInfoToJson(this);

}


